package com.zking.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zking.entity.User;
import com.zking.mapper.IUserMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by OWen on 2023-2023/11/27, project: springboot1206.
 * <p>
 * Author: OWen
 * Create Date: 2023/11/27
 * Project: com.zking.service in project: springboot1206
 * <p>
 * Notice: If you are using this class or file, check it and do some modification.
 */
@Service @RequiredArgsConstructor
public class UserService {
    private final IUserMapper userMapper;
    // private final IOrderMapper orderMapper;
    
    public List<User> getAll() {
        return userMapper.selectList(null);
    }
    
    public Page<User> getPage(int pageNum, int pageSize) {
        return userMapper.selectPage(Page.of(pageNum, pageSize), new QueryWrapper<>());
    }
}
